﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZCrawler
{
    public class ZCrawlDataCleanHtmlTagProcessor : ZCrawlDataProcessor
    {
        public override string Process(string str)
        {
            char[] array = new char[str.Length];
            int arrayIndex = 0;
            bool inside = false;

            for (int i = 0; i < str.Length; i++)
            {
                char let = str[i];
                if (let == '<')
                {
                    inside = true;
                    continue;
                }
                if (let == '>')
                {
                    inside = false;
                    continue;
                }
                if (!inside)
                {
                    array[arrayIndex] = let;
                    arrayIndex++;
                }
            }
            return new string(array, 0, arrayIndex);
        }

        public override string Description
        {
            get
            {
                return "HTML Tag Cleaner";
            }
        }
    }
}
